using System;
using System.Linq.Expressions;
using System.Web.Mvc;
using FwkLight.Application;
using MvcContrib;

namespace FwkLight.Web.MVC
{
  public abstract class BaseController : Controller
  {
    protected internal ViewDataDictionary internalViewData { get { return base.ViewData; } }

    public new ViewDataDictionary ViewData
    {
      get
      {
        throw new NotImplementedException("All models must be strongly typed. (use the Model property directly).");
      }
    }

    public object Model
    {
      get
      {
        return base.ViewData.Model;
      }
    }

    public ActionResult RedirectToAction<T> ( Expression<Action<T>> action ) where T : Controller
    {
      return ControllerExtensions.RedirectToAction(this, action);
    }

    public Task<T> Task<T>()
    {
      return new Task<T>();
    }
  }
}